package net.rlair.sbdemo.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * 切面类.
 *
 * @author li gu
 */
@Component
@Aspect
@Order(1)
public class LiGu2 {

    @Pointcut("execution(public * net.rlair.sbdemo.controller.ZhaozichenController.list())")
    public void pointCut(){}

    @AfterThrowing("pointCut()")
    public void afterReturning() {
        System.out.println("ligu2 afterReturning...");
    }

    @Around("pointCut()")
    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("ligu2 around before...");
        final Object obj = joinPoint.proceed();
        System.out.println("ligu2 around after...");
        return obj;
    }
}
